package lc.数学问题;

/**
 * @description: 3的幂
 * @author: qian
 * @createDate: 2021/9/24
 */
public class Math326_3的幂 {

    public boolean isPowerOfThree(int n) {

        if (n <= 0) {
            return false;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        return n == 0; // 3^0=0;
    }
}
